from rest_framework.generics import GenericAPIView
from rest_framework.mixins import ListModelMixin
from rest_framework.viewsets import GenericViewSet
from . import models
from . import serializer
from django.conf import settings


# class Banner(GenericAPIView, ListModelMixin):
# class BannerView(GenericAPIView,ListModelMixin):  # 这个路由配置path('banner/', views.BannerView.as_view()),

class BannerView(GenericViewSet, ListModelMixin):
    queryset = models.Banner.objects.filter(is_delete=False, is_show=True).order_by('display_order')[
               :settings.BANNER_COUNTER]
    serializer_class = serializer.BannerModelSerializer
